package com.example.sugar.mapper;

import com.example.sugar.bean.ExamOne;
import com.example.sugar.bean.ExamTwo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ExamStateMapper {

    @Select("select sum(a) a,\n" +
            "sum(b) b,\n" +
            "sum(c) c,\n" +
            "sum(d) d,\n" +
            "sum(e) e \n" +
            "from dws_exam_paper_distribution_window \n" +
            "WHERE toYYYYMMDD(stt) = #{date}")
    ExamOne selectAnswer(@Param("date") Integer date);

    @Select("select question_id,sum(ct) ct\n" +
            "from dws_exam_answer_window \n" +
            "WHERE toYYYYMMDD(stt) = #{date}")
    List<ExamTwo> selectNum(@Param("date") Integer date);

    @Select("select  sum(user_num) user_num\n" +
            " from dws_exam_stat_window" +
            "WHERE toYYYYMMDD(stt) = #{date}")
    Integer selectUserNum(@Param("date") Integer date);

    //各试卷考试人数
    @Select("select  sum(user_num) user_num\n" +
            " from dws_exam_stat_window" +
            "WHERE toYYYYMMDD(stt) = #{date}")
    Integer selectUserNum1(@Param("date") Integer date);

    //各试卷平均分
    @Select("select sum(score_num)/sum(user_num) over_count\n" +
            "from dws_exam_stat_window" +
            "WHERE toYYYYMMDD(stt) = #{date}")
    Integer selectUserNum2(@Param("date") Integer date);
}
